package com.hksj.am.controller;

import com.hksj.am.query.AmmoniaCockpitQuery;
import com.hksj.am.service.AmmoniaCockpitService;
import com.hksj.am.vo.AlarmDeviceInfoVO;
import com.hksj.am.vo.AlarmNumTrendVO;
import com.hksj.am.vo.AlarmRoomVO;
import com.hksj.am.vo.CurrentAlarmDeviceInfoVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author fjt
 * @data 2024/11/5 18:12
 * @describe 氨气监测系统驾驶舱
 */
@Api(tags = "氨气监测——驾驶舱")
@RestController
@RequestMapping("/api/am/cockpit")
public class AmmoniaCockpitController {


    @Autowired
    private AmmoniaCockpitService ammoniaCockpitService;


    @PostMapping("/queryCurrentAlarmDevice")
    @ApiOperation(value = "查询当前报警设备信息", notes = "查询当前报警设备信息",response = CurrentAlarmDeviceInfoVO.class)
    public Rest<CurrentAlarmDeviceInfoVO> queryCurrentAlarmDevice(@RequestBody AmmoniaCockpitQuery query){
        return Rest.ok(ammoniaCockpitService.queryCurrentAlarmDevice(query));
    }


    @PostMapping("/topFive")
    @ApiOperation(value = "告警区域排行Top5（最近7天）", notes = "告警区域排行Top5（最近7天）",response = CurrentAlarmDeviceInfoVO.class)
    public Rest<List<AlarmRoomVO>> queryAlarmNum(@RequestBody AmmoniaCockpitQuery query){
        return Rest.ok(ammoniaCockpitService.queryAlarmNum(query));
    }


    @PostMapping("/queryAlarmTrend")
    @ApiOperation(value = "告警次数趋势（最近7天）", notes = "告警次数趋势（最近7天）",response = AlarmNumTrendVO.class)
    public Rest<List<AlarmNumTrendVO>> queryAlarmTrend(@RequestBody AmmoniaCockpitQuery query){
        return Rest.ok(ammoniaCockpitService.queryAlarmTrend(query));
    }


    @PostMapping("/queryAlarmDetail")
    @ApiOperation(value = "告警记录详情（最近7天）", notes = "告警次数趋势（最近7天）",response = AlarmDeviceInfoVO.class)
    public Rest<List<AlarmDeviceInfoVO>> queryAlarmDetail(@RequestBody AmmoniaCockpitQuery query){
        return Rest.ok(ammoniaCockpitService.queryAlarmDetail(query));
    }


}
